package ace.cmp.spring.data.jdbc.querydsl.annotation.processor;

import com.querydsl.codegen.EntityType;
import com.querydsl.sql.codegen.DefaultNamingStrategy;

/**
 * @author caspar
 * @date 2023/4/6 14:43
 */
public class AceDefaultNamingStrategy extends DefaultNamingStrategy {

  @Override
  public String getDefaultAlias(EntityType entityType) {
    return getDefaultVariableName(entityType);
  }

  @Override
  public String getDefaultVariableName(EntityType entityType) {
    String variable =
        entityType.getSimpleName().substring(0, 1).toLowerCase()
            + entityType.getSimpleName().substring(1);
    return normalizeJavaName(variable);
  }
}
